#ifndef RIGHTCLICKMENU_H
#define RIGHTCLICKMENU_H

#include <QMenu>
#include <QAction>
#include <QObject>
#include <QPoint>
#include <QDebug>

class RightClickMenu : public QObject
{
    Q_OBJECT

public:
    explicit RightClickMenu(QWidget *parent = nullptr);
    ~RightClickMenu();

    // 显示菜单在指定位置
    void show(const QPoint &pos);

signals:
    void refreshTriggered();
    void copyTriggered();
    void startTriggered();
    void stopTriggered();
    void renameTriggered();
    void deleteTriggered();
    void propertiesTriggered();

private slots:
    void onRefresh();
    void onCopy();
    void onStart();
    void onStop();
    void onRename();
    void onDelete();
    void onProperties();

private:
    QMenu *m_menu;
    QAction *m_refreshAction;
    QAction *m_copyAction;
    QAction *m_startAction;
    QAction *m_stopAction;
    QAction *m_renameAction;
    QAction *m_deleteAction;
    QAction *m_propertiesAction;
    QAction *m_separator; // 分隔线

    void createActions();
    void setupMenu();
};

#endif // RIGHTCLICKMENU_H
